package com.ruoyi.market.domain;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.entity.SysUser;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * 
 * @TableName market_order
 */
@TableName(value ="market_order")
@Data
public class Order extends BaseEntity implements Serializable {
    /**
     * 订单编号=DJ + 当前时间毫秒数
     */
    @TableId
    @Excel(name = "订单编号")
    private String orderIndent;

    /**
     * 客户id（外键客户表）
     */
    @Excel(name = "客户id")
    private Integer mkCustomerId;
    @TableField(exist = false)
    private Customer customer;

    /**
     * 订购时间
     */
    @Excel(name = "订购时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date orderTime;

    /**
     * 总金额
     */
    @Excel(name = "总金额")
    private Double orderMoney;

    /**
     * 操作人id(user 外键)
     */
    @Excel(name = "操作人id")
    private Integer sysOperUserId;
    @TableField(exist = false)
    private SysUser sysOperUser;

    /**
     * 审核状态(0/1/2/3)未审核/审核中/审核通过/审核不通过
     */
    @Excel(name = "审核状态(0/1/2/3)未审核/审核中/审核通过/审核不通过")
    private String chkStatus;

    /**
     * 审核id(user 外键)
     */
    @Excel(name = "审核id")
    private Integer sysChkUserId;
    @TableField(exist = false)
    private SysUser sysChkUser;

    /**
     * 审核时间
     */
    @Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date checkTime;

    /**
     * 审核意见
     */
    @Excel(name = "审核意见")
    private String opinion;

    /**
     * 仓库id(Warehouse 外键)
     */
    @Excel(name = "仓库id")
    private Integer repoWareId;

    /**
     * 出库状态0(出库)1(未出库)
     */
    @Excel(name = "出库状态0(出库)1(未出库)")
    private String ckStatus;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Order other = (Order) that;
        return (this.getOrderIndent() == null ? other.getOrderIndent() == null : this.getOrderIndent().equals(other.getOrderIndent()))
            && (this.getMkCustomerId() == null ? other.getMkCustomerId() == null : this.getMkCustomerId().equals(other.getMkCustomerId()))
            && (this.getOrderTime() == null ? other.getOrderTime() == null : this.getOrderTime().equals(other.getOrderTime()))
            && (this.getOrderMoney() == null ? other.getOrderMoney() == null : this.getOrderMoney().equals(other.getOrderMoney()))
            && (this.getSysOperUserId() == null ? other.getSysOperUserId() == null : this.getSysOperUserId().equals(other.getSysOperUserId()))
            && (this.getChkStatus() == null ? other.getChkStatus() == null : this.getChkStatus().equals(other.getChkStatus()))
            && (this.getSysChkUserId() == null ? other.getSysChkUserId() == null : this.getSysChkUserId().equals(other.getSysChkUserId()))
            && (this.getCheckTime() == null ? other.getCheckTime() == null : this.getCheckTime().equals(other.getCheckTime()))
            && (this.getOpinion() == null ? other.getOpinion() == null : this.getOpinion().equals(other.getOpinion()))
            && (this.getRepoWareId() == null ? other.getRepoWareId() == null : this.getRepoWareId().equals(other.getRepoWareId()))
            && (this.getCkStatus() == null ? other.getCkStatus() == null : this.getCkStatus().equals(other.getCkStatus()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getOrderIndent() == null) ? 0 : getOrderIndent().hashCode());
        result = prime * result + ((getMkCustomerId() == null) ? 0 : getMkCustomerId().hashCode());
        result = prime * result + ((getOrderTime() == null) ? 0 : getOrderTime().hashCode());
        result = prime * result + ((getOrderMoney() == null) ? 0 : getOrderMoney().hashCode());
        result = prime * result + ((getSysOperUserId() == null) ? 0 : getSysOperUserId().hashCode());
        result = prime * result + ((getChkStatus() == null) ? 0 : getChkStatus().hashCode());
        result = prime * result + ((getSysChkUserId() == null) ? 0 : getSysChkUserId().hashCode());
        result = prime * result + ((getCheckTime() == null) ? 0 : getCheckTime().hashCode());
        result = prime * result + ((getOpinion() == null) ? 0 : getOpinion().hashCode());
        result = prime * result + ((getRepoWareId() == null) ? 0 : getRepoWareId().hashCode());
        result = prime * result + ((getCkStatus() == null) ? 0 : getCkStatus().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", orderIndent=").append(orderIndent);
        sb.append(", mkCustomerId=").append(mkCustomerId);
        sb.append(", orderTime=").append(orderTime);
        sb.append(", orderMoney=").append(orderMoney);
        sb.append(", sysOperUserId=").append(sysOperUserId);
        sb.append(", chkStatus=").append(chkStatus);
        sb.append(", sysChkUserId=").append(sysChkUserId);
        sb.append(", checkTime=").append(checkTime);
        sb.append(", opinion=").append(opinion);
        sb.append(", repoWareId=").append(repoWareId);
        sb.append(", ckStatus=").append(ckStatus);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}